cmake_minimum_required(VERSION 3.0)
project(sylar)
add_definitions(-Wno-builtin-macro-redefined)
include (cmake/utils.cmake)

set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -rdynamic -O0 -fPIC -ggdb -std=c++11 -Wall -Wno-deprecated -Werror -Wno-unused-function")
set(LIB_SRC
    src/log.cc
    src/util.cc
    src/macro.cc
    src/config.cc)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
add_library(sylar SHARED ${LIB_SRC})
redefine_file_macro(sylar)

include_directories (${PROJECT_SOURCE_DIR}/src) # 头文件搜索路径
link_directories(${PROJECT_SOURCE_DIR}/src)  # 库文件搜索路径

add_executable(test_config ${PROJECT_SOURCE_DIR}/tests/test_config.cc) # 指定生成的可执行文件
redefine_file_macro(test_config)
add_dependencies(test_config sylar)
target_link_libraries(test_config sylar yaml-cpp)  # 执行可执行文件需要依赖的库